﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SchEdu.Framework.DataModel;
using SchEdu.Framework.Validators;

namespace SchEdu.Framework.Objective
{
    class TotalEarliness : Objective
    {
        public TotalEarliness()
            : base()
        {
        }
        public TotalEarliness(SchEduData schEduData, SchEduDataSet.SolutionRow solution)
            : base(schEduData, solution)
        {
        }
        protected override void Logic()
        {
            int earliness = 0;
            int totalEarliness = 0;

            foreach (SchEduDataSet.OrderRow order in SchEduData.Order)
            {
                earliness = Math.Max(0,order.DueDate - order.EndDate);
                totalEarliness = totalEarliness + earliness;
            }

        }

        protected override void InitializeValidators()
        {
            base.InitializeValidators();
            validators.Add(new OrderDueDateValidator(SchEduData));
            validators.Add(new OrderEndDateValidator(SchEduData));
        }

        public override AboutInfo AboutInfo
        {
            get
            {
                AboutInfo aboutInfo = new AboutInfo();
                aboutInfo.Title = "Total Earliness";
                aboutInfo.Guid = new Guid("{A8CD49B0-D6CA-49b3-9DB3-05A2C0C085AB}");
                aboutInfo.Description = Resources.TotalEarlinessDescription;
                return aboutInfo;
            }
        }

    }
}
